<?php
/**
 * SocialEngine
 *
 * @category   Application_Core
 * @package    Core
 * @copyright  Copyright 2011 Vinatay Developments
 * @license    http://www.vinatay.com
 * @version    $Id: index.tpl 4334 06-21-2011 04:00:39Z Nam $
 */
?>

<script language="JavaScript">
	function onOver() {
		document.getElementById('more').className = 'activee';
	}
	function onOut() {
		document.getElementById('more').className = 'view_more_menu';
	}
</script>

<?php
$modu = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
$acti = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$i = 0;
$number_visible_menuitem = $this->main_menu_item;
$arrMore = array();
$total = 0;
//$cItem = count($this->navigation);
?>

<div id='layout_core_menu_main'>
 <ul>
    <?php foreach( $this->navigation as $item ): ?>
    	<?php
        $label = $item->getLabel();
		if($i < $number_visible_menuitem){
	    	if((strstr(strtolower($label),$modu) != "") || ($modu=="core" && $label=="Home") || ($modu=="user" && $label=="Members" && $acti != "home") || ($modu=="user" && strtolower($label)==$acti)){
	    	?>
	    	<li class="active"><?php echo "<a href='" . $item->getHref() . "'><b>" . $this->translate($item->getLabel()) . "</b></a>"?></li>
	        <?php
	        $total +=1;
	        $i += 1;
	    	}else{
	        ?>
	        <li><?php echo "<a href='" . $item->getHref() . "'><b>" . $this->translate($item->getLabel()) . "</b></a>"?></li>
	        <?php
	        $i += 1;
	        }
	    }else{
		  	if(strstr(strtolower($label),$modu) != ""){
		  	//$arrMore[$i] = $this->htmlLink($item->getHref(), $this->translate($item->getLabel()));
	    	$arrMore[$i] = "<a href='" . $item->getHref() . "' class ='active' onMouseover='onOver()' onMouseOut='onOut()'>" . $this->translate($item->getLabel()) . "</a>";
	  		$i += 1;
	    	}else{
	    	$arrMore[$i] = "<a href='" . $item->getHref() . "' onMouseover='onOver()' onMouseOut='onOut()'>" . $this->translate($item->getLabel()) . "</a>";
	  		$i += 1;
	    	}
	    }
       ?>
    <?php endforeach;
    if($i > $number_visible_menuitem){
    if($total > 0){
    ?>
    <li id = "more" class="view_more_menu">
        <a  href="javascript: void(0)">
        <b><?php echo $this->translate('More');?> </b>           
        </a> 
        <div id="dropmenu1" class="dropmenudiv">
            <?php
                for($j = $number_visible_menuitem; $j < $i; $j++){
                    echo $arrMore[$j];
                }
            ?>
        </div>          
    </li>
    <?php
    }else{
    ?>                               
    <li id = "more" class="activee">
        <a href="javascript: void(0)">
        <b> <?php echo $this->translate('More');?></b>
        </a>
          <div id="dropmenu1" class="dropmenudiv">
            <?php
                for($j = $number_visible_menuitem; $j < $i; $j++){
                    echo $arrMore[$j];
                }
            ?>
        </div>     
    </li>
    <?php
    }
    }
    ?>
    </ul>

 </div>







